#include "swpreportdocument.h"

#include "data/reportdata.h"

#include <coremimetypes.h>
#include <mimetypemanager.h>

using namespace core;
using namespace swp;

typedef QSharedPointer<core::IDocument> Document;

SwpReportDocument::SwpReportDocument(const QString& name,
    const MimeType& mimeType,
    const QSharedPointer<core::IContainerDocument>& container,
    bool isFuture) : SwpAbstractLinkedDocument(name, mimeType, container,
        isFuture),
        m_reportData(new ReportData())
{
    connect(m_reportData, SIGNAL(dataChanged()),
        this, SLOT(makeDirty()));

    m_data = m_reportData;

    m_valid = true;
}

SwpReportDocument::~SwpReportDocument()
{

}

QList<MimeType> SwpReportDocument::linksTo() const
{
    QList<MimeType> ret;

    ret.append(MimeTypeManager::getInstance()->mimeType(
        SIM_CASE_MIMETYPE));

    return ret;
}

void SwpReportDocument::linksUpdated(bool projectIsOpening)
{
}

// private slots

void SwpReportDocument::handleValidChange(bool valid)
{
    setValid(valid);
}
